<template>
  <div>
    <ZgEdit
      ref="dialog"
      :columns="columns"
      :formulas="formulas"
      :inputClick="inputClick"
      validUrl=""
      saveUrl=""
      :view="view"
      @ok="$emit('ok')">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data () {
    return {
      view: {
        width: '60%',
        top: '3%',
        title: '新增'
      },
      columns: [
        { name: '产品类型', code: 'companyName', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '状态', code: 'orgType', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { 下拉选项: [{ value: '1', label: '启用' }, { value: '2', label: '禁用' }] } },
        { name: '额度区间最小值', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 12, defaultVal: 0, unit: '万元' },
        { name: '额度区间最大值', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 12, defaultVal: 0, unit: '万元' },
        { name: '利率区间最小值', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 12, defaultVal: 0, unit: '万元' },
        { name: '利率区间最大值', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 12, defaultVal: 0, unit: '万元' },
        { name: '货款期限开始日期', code: 'startDate', compType: '日期', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '货款期限结束日期', code: 'endDate', compType: '日期', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '适用场景', code: 'comType', compType: '多选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'political' } },
        { name: '是否信用贷', code: 'political', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 选项: [{ value: '1', label: '是' }, { value: '2', label: '否' }] } },
        { name: '是否抵押', code: 'political', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 选项: [{ value: '1', label: '是' }, { value: '2', label: '否' }] } },
        { name: '是否担保', code: 'political', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 选项: [{ value: '1', label: '是' }, { value: '2', label: '否' }] } },
        { name: '保证金', code: 'political', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 选项: [{ value: '1', label: '缴纳' }, { value: '2', label: '不缴纳' }] } }
      ],
      formulas: []
    }
  },
  methods: {
    open (obj, pageType) {
      if (pageType === 'details') {
        this.view.title = '详情'
        this.$refs.dialog.open()
      } else {
        this.view.title = '编辑'
        this.$refs.dialog.open()
      }
    },
    inputClick (t) {
      alert(JSON.stringify(t))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
